#ifndef TRANSLATIONSTRATEGY_H
#define TRANSLATIONSTRATEGY_H

#if defined (_WIN32)
	#pragma once
#endif

#include "../../ToolkitLayer.h"
#include <LDF/VisComponentStrategy.h>

/**
 * This strategy defines simple translation of a component and its branch when
 * it is pressed and dragged.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since August 2, 2007
 */
class TOOLKITLAYER_API TranslationStrategy : public VisComponentStrategy
{
	// Attributes
protected:
	/** Determines when the component is being pressed. */
	bool pressed;
	/** The previous x-coordinate of the cursor position. */
	int previousX;
	/** The previous y-coordinate of the cursor position. */
	int previousY;

	/** Button buffer type identifier. */
	unsigned int buttonBufferType;

	// BUTTON BUFFER VALUES
	/** No button value. */
	unsigned char noButtonValue;
	/** Movable area button value. */
	unsigned char movableAreaButtonValue;
	/** Translation area button value. */
	unsigned char translationAreaButtonValue;

	// EVENT TYPES
	/** Press event type. */
	unsigned int pressType;
	/** Drag event type. */
	unsigned int dragType;
	/** Release event type. */
	unsigned int releaseType;


	// Methods
public:
	/**
	 * Constructs a translation strategy.
	 */
	TranslationStrategy(void);
	/**
	 * Destroys a translation strategy.
	 */
	~TranslationStrategy(void);

protected:
	/**
	 * Handles the given event.
	 *
	 * @param evt the event to be handled.
	 */
	void onEvent(LargeDisplayEvent* evt);
	

	/**
	 * Returns the value of the current active button buffer of the associated
	 * component at the given global coordinates. If there is no button buffer
	 * currently active for the associated component or the coordinates are not
	 * inside the buffer, a constant value for NO_BUTTON is returned.
	 *
	 * @param x the x global coordinate to be checked.
	 * @param y the y global coordinate to be checked.
	 * @return the value retrieved from the button buffer or
	 * a constant value for NO_BUTTON in case of failure.
	 */
	unsigned char getButtonValue(unsigned int x, unsigned int y);
};

#endif // TRANSLATIONSTRATEGY_H
